// 数据持久化
import { getToken, setToken, removeToken} from '@/utils/auth'
const state = {
  token: getToken()
}
const mutations = {
  setToken(state, token) {
    state.token = token
    setToken(token)
  }
}
const actions = {
  login(context, data) {
    // 调用登录接口 接受后端返回token 123456
    context.commit('setToken', '123456')
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
